package com.wangyk.rabbitmqconsole.config;

import com.wangyk.rabbitmqconsole.interceptor.AllInterceptor;
import com.wangyk.rabbitmqconsole.interceptor.ExternalInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description: 注册拦截器
 * @Author: wangyk
 * @CreateDate: 2019/1/9$ 14:32$
 * @UpdateUser: wangyk
 * @UpdateDate: 2019/1/9$ 14:32$
 * @UpdateRemark:
 * @Version: 1.0
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer
{
    public void addInterceptors(InterceptorRegistry registry)
    {
        //注册多个拦截器，拦截所有请求
        registry.addInterceptor(new ExternalInterceptor())
            .addPathPatterns("/**")
            .excludePathPatterns("*/select_all.do");
        //注册多个拦截器，拦截所有请求
        registry.addInterceptor(new AllInterceptor()).addPathPatterns("/**").excludePathPatterns("/select_all.do");
    }
}
